package com.sig;

import utils.Graphe;
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.TextView;

public class Itineraire{

	private Activity activity;
	private LayoutInflater inflater;
	public ViewGroup layout;
	private View button_choose_destination;
	private View button_choose_position;
	private View viewItineraire;
	public Graphe graphe;
	private TextView textDestination ;
	public Itineraire(final Activity activity, ViewGroup layout,Graphe g){
		this.layout = layout;
		this.activity = activity;
		graphe = g;
		inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		this.viewItineraire = inflater.inflate(R.layout.itineraire, null);
		layout.addView(this.viewItineraire);
		button_choose_destination = viewItineraire.findViewById(R.id.itineraire_location_2_texte);
		button_choose_destination.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {
				((MainActivity) Itineraire.this.activity)._recherche_layout.setVisibility(View.VISIBLE);
				((MainActivity) Itineraire.this.activity)._recherche.setFocusable(true);
				((MainActivity) Itineraire.this.activity)._recherche.setFocusableInTouchMode(true);

				((MainActivity) Itineraire.this.activity)._recherche.requestFocus();
				viewItineraire.setVisibility(View.GONE);
			}
		});

		if(MainActivity.modeBatiment){
			button_choose_position = viewItineraire.findViewById(R.id.itineraire_location_1_texte);
			button_choose_position.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					((MainActivity) Itineraire.this.activity).getQrCode();
				}
			});
		}
	}



	public void changerDestination(String nom) {
		textDestination.setText(nom);
	}
}
